

const express = require("express");

const app = express();
const path = require("path")

//连接数据库
require("./db/index")




//处理post和put请求的中间件
app.use(express.json());
app.use(express.urlencoded());

app.use("/upload", express.static(path.resolve(__dirname, "./upload")))


//引入集合
// const adminModel = require('./db/model/adminModel')

//添加
const addAdminRoute = require("./routes/addAdminRoute")
//查找
const adminRoute = require("./routes/adminRoute")
// 删除
const deleteRoute = require("./routes/deleteAdmin")
//登录
const loginRoure = require("./routes/loginRoute")
//跳转中间件
const isLogin = require("./routes/isLoginRoute")
//添加广告
const addAdvList = require("./routes/addAdvList")
//查询广告
const advList = require("./routes/advList")
//删除广告
const deleteAdvList = require("./routes/deleteAdvList")
//更新广告查询
const getUpdateData = require("./routes/getUpdateData")
//真正的更新广告
const updateAdv = require("./routes/updateAdv")
//使用路由
app.use(addAdminRoute)
app.use(adminRoute)
app.use(deleteRoute)
app.use(loginRoure)
app.use(isLogin)
app.use(addAdvList)
app.use(advList)
app.use(deleteAdvList)
app.use(getUpdateData)
app.use(updateAdv)



app.listen(8888, () => {
    console.log("服务器启动成功,请访问 http://127.0.0.1:8888");
})
